package src

import (
	"net/http"
	"appengine"
    "appengine/memcache"
    "utils"
    "text/template"
)

func init() {
	http.HandleFunc("/rss", rssHandler)
}


func rssHandler(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r) 
	w.Header().Set("Content-Type", "application/xhtml+xml")
	
	var recent = [] utils.Readme {}
  	memcache.Gob.Get(c, "recent", &recent)
	
	serverUrl := "http://" + r.Host
	
	t := template.Must(template.ParseFiles("templates/pages/rss.html"))
	
	t.Execute(w, map[string]interface{}{"recent" : recent, "serverUrl" : serverUrl}) 
}